package com.jiaoxiaobo.exchange.direct;

import com.jiaoxiaobo.RabbitMQUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import java.nio.charset.StandardCharsets;

public class DirectExchangeProducer {

    private static final String EXCHANGE_NAME = "directExchange-hello";

    public static void main(String[] args) throws Exception {
        Connection connection = RabbitMQUtil.getConnection();
        Channel channel = connection.createChannel();
        channel.exchangeDeclare(EXCHANGE_NAME,"direct");
        String message = "LOG INFO 44444";
        channel.basicPublish(EXCHANGE_NAME,"debug",null,message.getBytes(StandardCharsets.UTF_8));
        channel.close();
        connection.close();
    }

}
